<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
	<div region="center" style="padding:1px;">
	<t:datagrid name="zySnCheckRecordList" checkbox="true" fitColumns="false" title="序列号验证异常记录" actionUrl="zySnCheckRecordController.do?datagrid" idField="id" fit="true" queryMode="group">
		<t:dgCol title="ID"  field="id"  hidden="true"  queryMode="group"  width="120" />
		<t:dgCol title="设备SN"			field="sn"					queryMode="single"	query="true"	width="100" />
		<t:dgCol title="机型"			field="esType"				queryMode="single"  width="100" />
		<t:dgCol title="BP"				field="bp"					queryMode="single"  query="true"	width="100" />
		<t:dgCol title="所在影院名称"		field="belongCinemaName"	queryMode="single"  width="120" />
		<t:dgCol title="保修截止日期"		field="repairEndDate"		formatter="yyyy-MM-dd"   queryMode="single"  width="100" />
		<t:dgCol title="异常发生日期"		field="exceptionDate"		formatter="yyyy-MM-dd"   queryMode="group"	query="true"	width="100" />
		<t:dgCol title="异常来源"		field="exceptionSource"		queryMode="single"	query="true"  width="60" dictionary="<%=StaticValue.DIC_SN_EXCEPTION_SOURCE %>" />
		<t:dgCol title="异常原因"		field="exceptionReason"		queryMode="single"  width="120" />
		<t:dgCol title="详情"			field="detail"				queryMode="single"  width="120" />
		<t:dgCol title="备件类型"		field="itemType"			queryMode="single"  width="120" />
		<t:dgCol title="备件号"			field="item"				queryMode="single"  width="120" />
		<t:dgCol title="系统记录序列号"	field="sysSn"				queryMode="single"  width="120" />
		<t:dgCol title="异常序列号"		field="exceptionSn"			queryMode="single"  width="120" />
		<t:dgCol title="处理结果"		field="dealResult"			queryMode="single"	query="true"  width="120" dictionary="<%=StaticValue.DIC_SN_CHECK_DEAL_RESULT%>" />
		<t:dgCol title="操作"		field="opt" width="100"></t:dgCol>
		<t:dgFunOpt title="忽略" funname="ignoreCheckRecordInCol(id)" />
		<t:dgFunOpt title="处理" funname="dealCheckRecordInCol(id)" />
		<t:dgToolBar title="批量忽略" icon="icon-add" url="" funname="batchIgnore"></t:dgToolBar>
	</t:datagrid>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	//给时间控件加上样式
	$("#zySnCheckRecordListtb").find("input[name='repairEndDate_begin']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
	$("#zySnCheckRecordListtb").find("input[name='repairEndDate_end']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
	$("#zySnCheckRecordListtb").find("input[name='exceptionDate_begin']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
	$("#zySnCheckRecordListtb").find("input[name='exceptionDate_end']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
});
function ignoreCheckRecordInCol(id){
	dealCheckRecord([id],"ignore");
}
function dealCheckRecordInCol(id){
	dealCheckRecord([id],"deal");
}
function batchIgnore(){
	var selections = $("#zySnCheckRecordList").datagrid("getSelections");
	if(selections.length < 1){
		tip("请选择要忽略的项目");
		return ;
	}else{
		var ids = [];
		$(selections).each(function(i,item){
			ids.push(item.id);
		});
		dealCheckRecord(ids,"ignore");
	}
}
function dealCheckRecord(idsArr,type){
	$.ajax({
		url : "zySnCheckRecordController.do?checkSnCheckRecord",
		data : {
			"ids" : idsArr.join(",")
			},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				$.ajax({
					url : "zySnCheckRecordController.do?doHandleSnCheckRecord",
					data : {
						"ids" : idsArr.join(","),
						"type" : type
						},
					cache : false,
					dataType : 'json',
					type : 'POST',
					success : function(data){
						tip(data.msg);
						reloadTable();
					}
				});
			}else{
				tip(data.msg);
			}
		}
	});
}
</script>